﻿#include "brj_mdiarea.h"
#include <QMimeData>
#include <QDebug>

brj_mdiarea::brj_mdiarea(QWidget *parent) :
    QMdiArea(parent)
{
    setAcceptDrops(true);
}

void brj_mdiarea::dropEvent(QDropEvent *event)
{
    QList<QUrl> urls = event->mimeData()->urls();
    if(urls.isEmpty())
        return;

    foreach(QUrl url, urls) {
        QString file_name = url.toLocalFile();
        //qDebug() << file_name;
    }
    emit sig_dropFile(urls.takeLast().toLocalFile());
}
void brj_mdiarea::dragEnterEvent(QDragEnterEvent *event)
{
    if(event->mimeData()->hasFormat("text/uri-list"))
        event->acceptProposedAction();
}
